package com.libraryManage.commons.utils;

import com.libraryManage.commons.config.Const;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@Data
public class ResponseEntity<T> implements Serializable {

    @ApiModelProperty(value = "返回状态码")
    private int code;
    @ApiModelProperty(value = "返回状态信息")
    private String msg;
    @ApiModelProperty(value = "返回数据")
    private T data;
    @ApiModelProperty(value="数据总条数（分页使用）")
    private int total;

    public ResponseEntity() {
    }

    public ResponseEntity(T data){
        this.code = Const.STAT_SUCC;
        this.msg = Const.MSG_SUCC;
        this.data = data;
    }

    public ResponseEntity(int code, String msg, int total, T data) {
        this.code = code;
        this.msg = msg;
        this.total = total;
        this.data = data;
    }


}
